#define _CRT_SECURE_NO_WARNINGS
#include"vector.h"
void test1()
{
	mh::vector<int> v;
	//v.push_back(1);
	//v.push_back(2);
	//v.push_back(3);
	//v.push_back(4);
	//v.push_back(5);
	cout << v.capacity() << endl;
	v.resize(10, 0);
	cout << v.size() << endl;
	cout << v.capacity() << endl;
	for (auto e : v)
		cout << e << " ";
}
void test2()
{
	mh::vector<int> v(10, 27);
	for (auto e : v)
		cout << e << " ";
	cout << endl;

	std::string s = "hello world";
	mh::vector<int> c(v.begin(), v.end());
	for (auto e : c)
		cout << e << " ";
	cout << endl;

	mh::vector<int> v1(5, 1);
	for (auto e : v1)
		cout << e << " ";
	cout << endl;

	v = v1;
	for (auto e : v)
		cout << e << " ";
	cout << endl;
}
void test3()
{
	mh::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	for (auto e : v)
		cout << e << " ";
	cout << endl;

	mh::vector<int>::iterator pos = find(v.begin(), v.end(), 1);
	//pos = v.insert(pos, 0);
	////cout << *pos << endl;
	//for (auto e : v)
	//	cout << e << " ";
	//cout << endl;

	pos = find(v.begin(), v.end(), 1);
	pos = v.erase(pos);
	cout << *pos << endl;
	for (auto e : v)
		cout << e << " ";
	cout << endl;
}

void test4()
{
	mh::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	for (auto e : v)
		cout << e << " ";
	cout << endl;

	mh::vector<int> v1(v);
	for (auto e : v1)
		cout << e << " ";
	cout << endl;
}
class Solution {
public:
	mh::vector<mh::vector<int>> generate(int numRows) {
		mh::vector<mh::vector<int>> vv;
		vv.resize(numRows);
		for (int i = 0; i < numRows; ++i)
		{
			vv[i].resize(i + 1, 0);
		}
		for (int i = 0; i < numRows; ++i)
		{
			vv[i][0] = vv[i][vv[i].size() - 1] = 1;
		}
		for (int i = 0; i < numRows; ++i)
		{
			for (int j = 0; j < vv[i].size(); ++j)
			{
				if (vv[i][j] == 0)
				{
					vv[i][j] = vv[i - 1][j] + vv[i - 1][j - 1];
				}
			}
		}
		return vv;
	}
};

int main()
{
	mh::vector<mh::vector<int>> vv;
	int numRows = 10;
	vv = Solution().generate(numRows);
	for (int i = 0; i < numRows; ++i)
	{
		for (int j = 0; j < vv[i].size(); ++j)
		{
			cout << vv[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}